import React from 'react';

import './index.less';


import {render} from '../../../../../hrpub/common/frame';

import {base} from 'nc-lightapp-front';

import ExportAction from '../../actions/export';

import PersonRefer from '../../../../public/components/PersonRefer';

const {
    NCModal,
    NCButton
} = base;

const {Header, Body, Footer} = NCModal;

const rptTypeMap = {
    entry: 3,
    leave: 5,
    regular: 4
};

export default render({
    actions: {
        expAct: ExportAction
    }
})(({props, state, action}) => {
    const {sca} = props;

    return (
        <NCModal
            show={sca.exportModal}
            onHide={action.expAct.closeModal}
            size="sm"
        >
            <Header
                closeButton={true}
            >
                {sca.language['gx6008-000127']/** 导出花名册 */}
            </Header>
            <Body>
                <div className="staff-change-export-modal-content">
                    <PersonRefer 
                        refcode="hrhi/refer/hiref/ReportDefineGridRef/index"
                        isMultiSelectedEnabled={false}
                        onChange={action.expAct.changeRefer}
                        value={sca.exportValue}
                        queryCondition={() => {
                            return {
                                rpt_type: rptTypeMap[sca.page],
                                pk_org: sca.orgValue[sca.page].refpk
                            }
                        }}
                    />
                </div>
            </Body>
            <Footer>
                <NCButton
                    colors="primary"
                    onClick={action.expAct.doExport}
                >
                    {sca.language['gx6008-000024']/** 确认 */}
                </NCButton>
                <NCButton
                    onClick={action.expAct.closeModal}
                >
                    {sca.language['gx6008-000025']/** 取消 */}
                </NCButton>
            </Footer>
        </NCModal>
    );

});